--[[ 编码: WMS-20-27 名称: 获取入库空料箱计算结果 作者:HAN 日期:2025-1-29 级别:项目 函数: GetEmptyBoxOutResult 功能: -- 点击领用按钮 更改记录: V3.0 HAN 20241231 改成后台线程来处理空料箱呼出计算,因为这个过程是一个比较长的事务,有并发锁表的风险 本次改进的目的就是将这些长事务统一交给后台一个线程排队处理 --]] wms_base = require ("wms_base") function GetEmptyBoxOutResult ( strLuaDEID ) local nRet, strRetInfo, n local paramter nRet, paramter = m3.GetSysDataJson( strLuaDEID ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), paramter ) end nRet, strRetInfo = mobox.getBackendScriptProcResult( paramter.proc_id ) local action = {} if ( nRet == 0 ) then -- 后台脚本还没处理完成 action[1] = { action_type = "wait", value = { time = 1, event = { cls_name = "入库单", event_name = "获取入库空料箱计算结果", data_json = { proc_id = paramter.proc_id } } } } elseif ( nRet == 1 ) then -- 后台脚本执行成功 local result = json.decode( strRetInfo ) local input_parameter = { cls_id = "Inbound_Wave", obj_id = result.wave_obj_id } local data_json = { cntr_count = result.cntr_count, cntr_cell_list = result.cntr_cell_list } action = { { action_type = "open_html_dlg", value = { dlg_name = "空料箱呼出确认", cls_id = "Inbound_Order", data_json = data_json, input_parameter = input_parameter } }, { action_type = "refresh", value = "" } } else -- 错误 mobox.setInfo( strLuaDEID, strRetInfo ) return end nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end